namespace LuckyLang.AST.Expression.ValueTyre;

public class DoubleValue : Value
{

    public DoubleValue(double value) => TheValue = value;

    public override Value PlusValue(Value other)
    {
        if (other is IntValue || other is DoubleValue)
            return new DoubleValue(Double.Parse(ToString())+Double.Parse(other.ToString()));
        return null;
    }
    public override Value MinusValue(Value other)
    {
        if (other is IntValue || other is DoubleValue)
            return new DoubleValue(Double.Parse(ToString())-Double.Parse(other.ToString()));
        return null;
    }
    public override Value TimesValue(Value other)
    {
        if (other is IntValue || other is DoubleValue)
            return new DoubleValue(Double.Parse(ToString())*Double.Parse(other.ToString()));
        return null;
    }
    public override Value DivideValue(Value other)
    {
        if (other is IntValue || other is DoubleValue)
            return new DoubleValue(Double.Parse(ToString())/Double.Parse(other.ToString()));
        return null;
    }
    public override bool LesserValue(Value  other) => (double)TheValue < double.Parse(other.ToString());
    public override bool GreaterValue(Value other) => (double)TheValue > double.Parse(other.ToString());
    public override bool LessEqValue(Value  other) => (double)TheValue <= double.Parse(other.ToString());
    public override bool GreaEqValue(Value  other) => (double)TheValue >= double.Parse(other.ToString());
}